package prac6;
/**
 * Represents a single subject.
 * 
 * @author Brendon Taylor
 * @since  August, 2009
 */
public class Subject {
	/** Unit code for the subject */
	private String unitCode;
	/** Unit name of the subject */
	private String unitName;
	/** Unit description of the subject */
	private String unitDescrption;
	
	/**
	 * @param       unitCode unit code for the subject
	 * @param       unitName unit name for the subject
	 * @complexity  O(1)
	 */
	public Subject(String unitCode, String unitName) {
		setUnitCode(unitCode);
		setUnitName(unitName);
		setUnitDescription("");
	}	
	
	/**
	 * @param       unitCode for the subject
	 * @param       unitName for the subject
	 * @param       unitDescription for the subject
	 * @complexity  O(1)
	 */	
	public Subject(String unitCode, String unitName, String unitDescription) {
		setUnitCode(unitCode);
		setUnitName(unitName);
		setUnitDescription(unitDescription);
	}
	
	/**
	 * converts a subject to a String.
	 * 
	 * @return      String representation of subject
	 * @complexity  best and worst case: O(1)
	 */
	public String toString() {
		return (getUnitDescription().equals("") ? getUnitCode() + ": " + getUnitName() : getUnitCode() + ": " + getUnitName() + "(" + getUnitDescription() + ")");
	}
	
	/* *************** ACCESSORS / MUTATORS **************** */
	
	/**
	 * @param unitCode the unitCode to set
	 */
	public void setUnitCode(String unitCode) {
		this.unitCode = unitCode;
	}

	/**
	 * @return the unitCode
	 */
	public String getUnitCode() {
		return unitCode;
	}
	
	/**
	 * @param unitName the unitName to set
	 */
	public void setUnitName(String unitName) {
		this.unitName = unitName;
	}

	/**
	 * @return the unitName
	 */
	public String getUnitName() {
		return unitName;
	}
	
	/**
	 * @param unitDescription the unitDescription to set
	 */
	public void setUnitDescription(String unitDescription) {
		this.unitDescrption = unitDescription;
	}

	/**
	 * @return the unitDescription
	 */
	public String getUnitDescription() {
		return unitDescrption;
	}
	
	/* ***************************************************** */	
}